﻿<#assign ctx=request.contextPath />
<!--_meta 作为公共模版分离出去-->
<#include "comm/_meta.html" />
<!--/meta 作为公共模版分离出去-->

<title>教室管理 - 教室列表</title>
</head>
<body>
	<!--_header 作为公共模版分离出去-->
	<#include "comm/_header.html" />
	<!--/_header 作为公共模版分离出去-->

	<!--_menu 作为公共模版分离出去-->
	<#include "comm/_menu.html" />
	<!--/_menu 作为公共模版分离出去-->

	<section class="Hui-article-box">
		<nav class="breadcrumb">
			<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
			教室管理 <span class="c-gray en">&gt;</span> 教室信息 <a
				class="btn btn-success radius r"
				style="line-height: 1.6em; margin-top: 3px"
				href="javascript:location.replace(location.href);" title="刷新"><i
				class="Hui-iconfont">&#xe68f;</i></a>
		</nav>
		<div class="Hui-article">
			<article class="cl pd-20">
				<div class="text-c">
					<!-- 日期范围： <input type="text"
						onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}'})"
						id="datemin" class="input-text Wdate" style="width: 120px;">
					- <input type="text"
						onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d'})"
						id="datemax" class="input-text Wdate" style="width: 120px;"> -->
					<form action="list" method="post">
						<input type="text" class="input-text" style="width: 250px"
							placeholder="输入教室名称" id="" name="crname" value="${crname }">
						<button type="submit" class="btn btn-success" id="" name="">
							<i class="Hui-iconfont">&#xe665;</i> 搜教室
						</button>
					</form>
				</div>
				<div class="cl pd-5 bg-1 bk-gray mt-20">
					<span class="l"> <a href="javascript:;"
						onclick="classroom_add('添加教室','${ctx}/room/toEditRoomView','800','500')"
						class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>
							添加教室</a>
					</span> <span class="r">共有数据：<strong>${pageData.total }</strong>
						条
					</span>
				</div>
				<table class="table table-border table-bordered table-bg">
					<thead>
						<tr>
							<th scope="col" colspan="9">教室列表</th>
						</tr>
						<tr class="text-c">
							<!-- <th width="25"><input type="checkbox" name="" value=""></th> -->
							<th width="40">ID</th>
							<th width="150">教室</th>
							<th width="150">是否有投影</th>
							<th width="150">时间</th>
							<!-- <th width="130">加入时间</th> -->
							<th width="100">操作</th>
						</tr>
					</thead>
					<tbody>
						<#list pageData.getRecords() as info>
							<tr class="text-c">
								<!-- <td><input type="checkbox" value="1" name=""></td> -->
								<td>${info.crId }</td>
								<td>${info.crName }</td>
								<td>${(info.touying?default('0')=='1')?string('是','否')!}</td>
								<td>${info.date1?date}</td>
								<td class="td-manage"><a title="编辑" href="javascript:;"
									onclick="classroom_edit('教室编辑','${ctx}/room/toEditRoomView?id=${info.crId }','1','800','500')"
									class="ml-5" style="text-decoration: none"> <i
										class="Hui-iconfont">&#xe6df;</i></a> <a title="删除"
									href="javascript:;"
									onclick="classroom_del('教室删除','${info.crId }')"
									class="ml-5" style="text-decoration: none"> <i
										class="Hui-iconfont">&#xe6e2;</i></a></td>
							</tr>
						</#list>
					</tbody>
				</table>
			</article>
			<nav class="breadcrumb" style="background: #fff;">
				当前页数:${pageData.current } 共 ${pageData.pages } 页
				<#if pageData.current < pageData.pages>
					<a class="btn radius r" style="line-height: 1.6em; margin-top: 3px"
						href="${ctx }/room/list?currentPageNo=${pageData.pages }&crname=${crname}"><span
						aria-hidden="true">尾页</span></a>
					<a class="btn radius r" style="line-height: 1.6em; margin-top: 3px"
						href="${ctx }/room/list?currentPageNo=${pageData.current+1 }&crname=${crname} "><span
						aria-hidden="true">下一页</span></a>
				</#if>
				<#if pageData.current gt 1 >
					<a class="btn radius r" style="line-height: 1.6em; margin-top: 3px"
						href="${ctx }/room/list?currentPageNo=${pageData.current-1 }&crname=${crname} "><span
						aria-hidden="true">上一页</span></a>
					<a class="btn radius r" style="line-height: 1.6em; margin-top: 3px"
						href="${ctx }/room/list?currentPageNo=1&crname=${crname}"><span
						aria-hidden="true">首页</span></a>
				</#if>
			</nav>
		</div>
	</section>

	<!--_footer 作为公共模版分离出去-->
	<#include "comm/_footer.html" />
	<!--/_footer /作为公共模版分离出去-->

	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript"
		src="${ctx }
		/static/lib/My97DatePicker/4.8/WdatePicker.js"></script>
	<script type="text/javascript"
		src="${ctx }
		/static/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript"
		src="${ctx }
	/static/lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.table-sort').dataTable({
				"aaSorting" : [ [ 1, "desc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 0, 8, 9 ]
				} // 制定列不参与排序
				]
			});
			$('.table-sort tbody').on('click', 'tr', function() {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				} else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
		});
		/*用户-添加*/

		/*用户-查看*/
		function member_show(title, url, id, w, h) {
			layer_show(title, url, w, h);
		}
		/*用户-编辑*/
		function classroom_edit(title, url, id, w, h) {
			layer_show(title, url, w, h);
		}
		/*用户-删除*/
		function classroom_del(title, id) {
			layer.confirm('确认要删除吗？', function(index) {
				$.ajax({
					type : "get",
					data : {cid : id},
					url : "delRoom",
					dataType : "json",
					success : function(data) {
						if (data.result == "success") { 
							layer.msg("已删除!", {icon : 1,time : 1000},function(){
								//刷新页面
								reload();
		                    });
						} else {
							layer.msg("删除失败!", {icon : 2,time : 1000});
						}
					},
					error : function(data) {
						console.log(data.msg);
					},
				});
			});
		}
		// 重新加载页面
		function reload(){
			//获取父层  
            var index = parent.layer.getFrameIndex(window.name);  
            //刷新父层  
            parent.location.reload(); 
            //location.replace("${ctx }/room/list?currentPageNo=1");
            //关闭弹出层  
            parent.layer.close(index);  
		}
	</script>
	<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>